package main

import (
	"fmt"
	"sync"
	"time"
)

// 1 - 200阶乘

var (
	myMap = make(map[int]int)
	lock sync.Mutex
)

func test(n int) {
	start := 1
	for i := 1;i <= n;i++ {
		start *= i
	}
	lock.Lock()
	myMap[n] = start
	lock.Unlock()

}

func main() {
	for i := 1;i<=200;i++ {
		go test(i)
	}

	time.Sleep(time.Second*1)
	for i, v := range myMap {
		fmt.Printf("[%d] = %d\n", i, v)
	}
	//fmt.Println(myMap)

}
